<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     *
     * @param Schedule $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        if ($this->app->environment() !== 'production') {
            // telescope
            $schedule->command('telescope:prune --hours=48')->daily();
            // telescope
            $schedule->command('plane.ticketing.order:try_to_ticket')->daily()->withoutOverlapping();
        } else {
            // 正式
            $schedule->command('official_station:update')->dailyAt('01:00')->withoutOverlapping();
            $schedule->command('count:snap_number')->hourly()->withoutOverlapping();
            $schedule->command('snap:start')->everyTenMinutes()
                     ->between('08:00', '23:00')
                     ->withoutOverlapping();
            $schedule->command('queue:prune-batches --hours=72')->daily();
            $schedule->command('plane.ticketing.order:try_to_ticket')->everyTenMinutes()->withoutOverlapping();
        }

    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
